package com.ds.infrastructure.hyperspace.console.model.request.stage;

import com.ds.infrastructure.hyperspace.console.entity.enums.TbPublicEnum;
import com.ds.infrastructure.hyperspace.console.entity.table.TbStage;
import com.ds.infrastructure.hyperspace.console.model.request.form.PageForm;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

/**
 * @author: yaozhendong
 * @create: 2019-09-20 09:37
 **/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class ListStageForm extends PageForm {

    @NotNull
    @ApiModelProperty(example = "1")
    private Long environmentId;

    public static TbStage toEntity(ListStageForm form) {
        TbStage tbStage = new TbStage();
        tbStage.setEnvironmentId(form.getEnvironmentId());
        tbStage.setGmtIsDeleted(TbPublicEnum.GMD_IS_DEL.NO.code);
        return tbStage;
    }
}
